
function vlcBrowse(path)
{
    this._path = path;
    
    this.display = function()
    {
        xmlDoc = loadXMLDoc(vlcServer()+"requests/browse.xml?dir="+this._path);
        if (!xmlDoc) alert('XML retreival failed');

        root=xmlDoc.documentElement;
        if (!root) alert('XML retreival failed');

        content_area = document.getElementById('content_area');
        browse_items = document.getElementById('browse_items');
        if (browse_items) content_area.removeChild(browse_items)
        browse_items = document.createElement('div');
        browse_items.setAttribute('id','browse_items');
        content_area.appendChild(browse_items);

        items = root.childNodes;
        for (var i = 0; i < items.length; i++)
        {
            item = items[i];
            if (item.nodeName == "element")
            {
                _type = item.getAttribute("type");
                _name = item.getAttribute("name");
                _size = item.getAttribute("size");
                _date = item.getAttribute("date");
                _path = escape(item.getAttribute("path").replace(new RegExp( /\\/g), "/") );
                _ext = item.getAttribute("extension");

                if (_type == 'directory')
                {
                    btn = document.createElement('button');
                    btn.setAttribute('onclick','taskFolderClicked(\''+escape(_path)+'\')');
                    btn.setAttribute('id','browse_item');
                    btnTxt = document.createTextNode(_name);
                    btn.appendChild(btnTxt);
                    browse_items.appendChild(btn);

                    br = document.createElement('br');
                    browse_items.appendChild(br);
                }
                else if (_type == 'file')
                {                    
                    btn = document.createElement('button');
                    btn.setAttribute('onclick','taskFileClicked(\''+_path+'\')');
                    btn.setAttribute('id','browse_item');
                    btnTxt = document.createTextNode(_name);
                    btn.appendChild(btnTxt);
                    browse_items.appendChild(btn);

                    br = document.createElement('br');
                    browse_items.appendChild(br);
                }
            }
        }
    };
}